package com.qf.controller;

import com.qf.pojo.req.GetTrainMsg;
import com.qf.pojo.req.TrainId;
import com.qf.pojo.resp.BaseResp;
import com.qf.service.CSeatDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@Api(value = "查询火车和动车以及详情信息", tags = "查询火车和动车以及详情信息")
@RestController
@RequestMapping("/train")
public class CSeatDetailController {
    @Autowired
    CSeatDetailService cSeatDetailService;

    @ApiOperation("查询火车以及动车")
    @RequestMapping(value = "/getTrain", method = RequestMethod.POST)
    public BaseResp getTeain(@RequestBody TrainId trainId) {
        return cSeatDetailService.getTrain(trainId.getDispatureId(), trainId.getDistinationId());
    }
    @ApiOperation("查询火车的详情信息")
    @RequestMapping(value = "/getcTrainMsg", method = RequestMethod.POST)
    public BaseResp getTrainMsg(@RequestBody GetTrainMsg getTrainMsg, HttpServletRequest request) {
        return cSeatDetailService.getTrainMsg(getTrainMsg.getCtrainId(), request);
    }
    @ApiOperation("查询动车的详情信息")
    @RequestMapping(value = "/getdTrainMsg", method = RequestMethod.POST)
    public BaseResp getdTrainMsg(@RequestBody GetTrainMsg getTrainMsg, HttpServletRequest request) {
        return cSeatDetailService.getdTrainMsg(getTrainMsg.getDtrainId(), request);
    }


}
